<!DOCTYPE html>
<html>
<head>
    <meta charset='UTF-8'>
    <title>改变样式</title>
    <style>
        h1 {
            display: inline-block;
        }
    </style>
    <script>
        function change(id){
            elem = document.getElementById(id);
            if(elem.style.color == "white"){
                elem.style.background = "white";
                elem.style.color = "black";
            }else{
                elem.style.background = "black";
                elem.style.color = "white";
            }
        }
    </script>
</head>
<body>
    <h1 id="content">Hello Wanker</h1>
    <button type="button" onclick="change('content')">改变样式</button>
</body>
</html>